From: Richard M. Stallman Date: Tue, 6 Apr 1993 17:11:57 +0000 (+0000) Subject: (dired-pop-to-buffer): Adjust count-lines val for last line. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96594 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=63ea14a5b218f071411b17b1ca98c0edeec185ec;p=emacs.git (dired-pop-to-buffer): Adjust count-lines val for last line. --- diff --git a/lisp/dired.el b/lisp/dired.el index 818261f1894..b44f8dd2bfd 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1422,7 +1422,10 @@ Optional argument means return a file name relative to `default-directory'." (set-buffer buf) (goto-char (point-max)) (skip-chars-backward "\n\r\t ") - (setq target-lines (count-lines (point-min) (point)))) + (setq target-lines (count-lines (point-min) (point))) + ;; Don't forget to count the last line. + (if (not (bolp)) + (setq target-lines (1+ target-lines)))) (if (<= (window-height window) (* 2 window-min-height)) ;; At this point, every window on the frame is too small to split. (setq w2 (display-buffer buf))